<template>
  <div class="student">
    <h1>学生名称:{{ name }}</h1>
    <h1>学生性别:{{ sex }}</h1>
    <button @click="sendStudentName">点我传递学生姓名</button>
  </div>
</template>

<script>
export default {
  name: "Student",
  data() {
    return {
      name: "陈嘉兴",
      sex: "男",
    };
  },
  methods: {
   sendStudentName() {
      this.$bus.$emit("hello", this.name);
    },
  },
};
</script>

<style >
.student {
  background-color: brown;
}
</style>